#ifndef GAME_H
#define GAME_H

#include<iostream>
#include <stdlib.h>
#include <ctime>
#include "../bgi/graphics.h"
#include "tablero.h"
#include "admarchi.h"
#include "boton.h"

typedef struct t_header
{
	int cant_cols;
	int cant_filas;
	int current_time;
	int minas_restantes;
	int mine_density;
	bool is_juego_perdido;
};

//Define de indices del vector de botones.
#define EASY 0
#define HARD 1
#define CUSTOM 2
#define SAVE 3
#define LOAD 4
#define EXIT 5

class Game
{
private:
	int _mouse_x;
	int _mouse_y;
	int _cant_cols;
	int _cant_filas;
	float _mine_density;
	bool _playing;
	char * _title;
	char * _status_bar;
	Tablero * _tablero;
	long double _start_time;
	int _current_time;
	bool _win;
	bool _hay_mensaje;
	ty_vec_status _game_status;
	Boton * _botones[6];
	Boton * _boton_easy;
	Boton * _boton_hard;
	Boton * _boton_custom;
	Boton * _boton_save;
	Boton * _boton_load;
	Boton * _boton_exit;

public:
	Game();
	~Game();
	void crear_ventana();
	void cerrar_ventana();
	int traducir_x(int x);
	int traducir_y(int y);
	void get_mouse_pos();
	void reset_mouse_pos();
	void set_title(const char * title);
	void set_status_bar();
	bool mouse_inside_tablero();
	bool mouse_inside_save();
	bool mouse_inside_load();
	bool mouse_inside_easy();
	bool mouse_inside_hard();
	bool mouse_inside_custom();
	bool mouse_inside_exit();
	void dibujar_botones();
	void get_custom_size();
	void start();
	void exit();
	void new_game();
	void save();
	void load();
	void load_header();
	void update_win();
	void update();
	void borrar_mensajes();
	void mostrar_minas_restantes();
	void reset_gametime();
	void update_gametime();
};
#endif